<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initExtjs()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->headTitle('АС "Интенсив"')->setSeparator(' - ');
        $view->headLink()->appendStylesheet('/extjs/resources/css/ext-all.css');
        $view->headLink()->appendStylesheet('/css/extjs-add.css');
        $view->headLink()->appendStylesheet('/extjs/resources/css/calendar.css');
        $view->headLink()->headLink(array('rel' => 'shortcut icon', 'href' => 'http://vstu.ru/favicon.ico'));
        $view->headScript()->appendFile('/extjs/adapter/ext/ext-base.js');
        $view->headScript()->appendFile('/extjs/ext-all-debug.js'); //TODO: поменять на релизный скрипт
        $view->headScript()->appendFile('/extjs/calendar-all.js');
        $view->headScript()->appendFile('/extjs/src/calendar/templates/DayHeaderTemplate.js');
        $view->headScript()->appendFile('/extjs/src/calendar/templates/DayBodyTemplate.js');
        $view->headScript()->appendFile('/extjs/src/calendar/templates/DayViewTemplate.js');
        $view->headScript()->appendFile('/extjs/src/calendar/templates/BoxLayoutTemplate.js');
        $view->headScript()->appendFile('/extjs/src/calendar/templates/MonthViewTemplate.js');
        $view->headScript()->appendFile('/extjs/src/calendar/dd/CalendarScrollManager.js');
        $view->headScript()->appendFile('/extjs/src/dd/StatusProxy.js');
        $view->headScript()->appendFile('/extjs/src/calendar/dd/CalendarDD.js');
        $view->headScript()->appendFile('/extjs/src/calendar/dd/DayViewDD.js');
        $view->headScript()->appendFile('/extjs/src/calendar/EventRecord.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/MonthDayDetailView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/widgets/CalendarPicker.js');
        $view->headScript()->appendFile('/extjs/src/calendar/WeekEventRenderer.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/CalendarView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/MonthView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/DayHeaderView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/DayBodyView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/DayView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/views/WeekView.js');
        $view->headScript()->appendFile('/extjs/src/calendar/widgets/DateRangeField.js');
        $view->headScript()->appendFile('/extjs/src/calendar/widgets/ReminderField.js');
        $view->headScript()->appendFile('/extjs/src/calendar/EventEditForm.js');
        $view->headScript()->appendFile('/extjs/src/calendar/EventEditWindow.js');
        $view->headScript()->appendFile('/extjs/src/calendar/CalendarPanel.js');
        $view->headScript()->appendFile('/js/ux/CheckColumn.js');
        $view->headScript()->appendFile('/extjs/src/locale/ext-lang-ru.js');
    }

    protected function _initACL()
    {
        $acl = new Zend_Acl();

        $acl->addRole('methodist');
        $acl->addRole('teacher');
        $acl->addRole('admin');

        $acl->addResource('json');
        $acl->addResource('print');

        $acl->allow('methodist', 'json', 'addlistenertolesson');
        $acl->allow('methodist', 'json', 'checklessonpresence');
        $acl->allow('methodist', 'json', 'deleteauditory');
        $acl->allow('methodist', 'json', 'deletecontract');
        $acl->allow('methodist', 'json', 'deleteintensive');
        $acl->allow('methodist', 'json', 'deletelesson');
        $acl->allow('methodist', 'json', 'deletelistener');
        $acl->allow('methodist', 'json', 'deletelistenerfromlesson');
        $acl->allow('methodist', 'json', 'deleteteacher');
        $acl->allow('methodist', 'json', 'duplicatelesson');
        $acl->allow('methodist', 'json', 'getauditoriesforgrid');
        $acl->allow('methodist', 'json', 'getauditorydata');
        $acl->allow('methodist', 'json', 'getcalendarschedule');
        $acl->allow('methodist', 'json', 'getcontractdata');
        $acl->allow('methodist', 'json', 'getcontractdetails');
        $acl->allow('methodist', 'json', 'getcontractsforgrid');
        $acl->allow('methodist', 'json', 'getintensivedata');
        $acl->allow('methodist', 'json', 'getintensivesforgrid');
        $acl->allow('methodist', 'json', 'getintensivesfortoolbar');
        $acl->allow('methodist', 'json', 'getlessondata');
        $acl->allow('methodist', 'json', 'getlessonpresence');
        $acl->allow('methodist', 'json', 'getlistenercontracts');
        $acl->allow('methodist', 'json', 'getlistenerdata');
        $acl->allow('methodist', 'json', 'getlistenerpresence');
        $acl->allow('methodist', 'json', 'getlistenersforaddingtolesson');
        $acl->allow('methodist', 'json', 'getlistenersforgrid');
        $acl->allow('methodist', 'json', 'getreceiptdata');
        $acl->allow('methodist', 'json', 'getteacherdata');
        $acl->allow('methodist', 'json', 'getteacherlessons');
        $acl->allow('methodist', 'json', 'getteachersforfilterpanel');
        $acl->allow('methodist', 'json', 'getteachersforgrid');
        $acl->allow('methodist', 'json', 'paycontract');
        $acl->allow('methodist', 'json', 'saveauditorydata');
        $acl->allow('methodist', 'json', 'savecontractdata');
        $acl->allow('methodist', 'json', 'saveintensivedata');
        $acl->allow('methodist', 'json', 'savelessondata');
        $acl->allow('methodist', 'json', 'savelistenerdata');
        $acl->allow('methodist', 'json', 'saveteacherdata');
        $acl->allow('methodist', 'json', 'unpaycontract');
        $acl->allow('methodist', 'print', 'printcontract');
        $acl->allow('methodist', 'print', 'printlistenerslist');
        $acl->allow('methodist', 'print', 'printorder');
        $acl->allow('methodist', 'print', 'teachercontract');

        $registry = Zend_Registry::getInstance();
        $registry->set('acl', $acl);
    }
}

